import React, { PureComponent } from 'react';
import { View, Dimensions } from 'react-native';

// import { getColors } from '../theme';

const X_WIDTH = 375;
const X_HEIGHT = 812;
const XMAX_WIDTH = 414;
const XMAX_HEIGHT = 896;
export default class SafeView extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {};
  }
  checkIPhoneX() {
    let { width, height } = Dimensions.get('window');
    if (width === X_WIDTH && height === X_HEIGHT) {
      return true;
    } else {
      return false;
    }
  }
  checkIPhoneXMax() {
    let { width, height } = Dimensions.get('window');
    if (width === XMAX_WIDTH && height === XMAX_HEIGHT) {
      return true;
    } else {
      return false;
    }
  }
  componentDidMount() {
    // console.log(this.props);
  }
  render() {
    let { type } = this.props;
    return this.checkIPhoneX() || this.checkIPhoneXMax() ? (
      type === 'top' ? (
        <View style={{ height: 44 }} />
      ) : (
        <View style={{ height: 30 }} />
      )
    ) : type === 'top' ? (
      <View style={{ height: 22 }} />
    ) : (
      <View style={{ height: 0 }} />
    );
  }
}
